﻿
<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>生产计划创建</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/js/layui/css/layui.css" rel="stylesheet" />
    <link href="~/X-admin/css/font.css" rel="stylesheet" />
    <script src="~/X-admin/lib/layui/layui.all.js"></script>
    <link href="~/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/X-admin/js/jquery.min.js"></script>
    <script src="~/X-admin/js/xadmin.js"></script>
    <script src="~/js/framework/sysframework.js"></script>

</head>
<body>
    <ul lay-bar="disabled" class="mWebBanner">
   
        <li class="layui-nav-item" style="float:left;">
            <button type="button" onclick="closeWin()" class="buttonCss">
                <i class="layui-icon" style="margin-right:3px">&#x1007;</i>关闭页面
            </button>
        </li>
    </ul>
    <div class="layui-card" style="margin-top:1%;padding-top:1%">
        <div class="layui-card-body layui-table-body layui-table-main" id="layui-table-main">
            <table class="layui-hide" id="list" lay-filter="list"></table>
        </div>
    </div>
    <div class="layui-card" style="margin-top:1%;padding-top:1%">
        <div class="layui-card-body layui-table-body layui-table-main" id="rd-layui-table-main">
            <table class="layui-hide" id="rdlist" lay-filter="rdlist"></table>
        </div>
    </div>
</body>
</html>
<script type="text/html" id="zyTools">
    <a title="删除信息" href="javascript:;" lay-event="del" id="frmDel"><i class="layui-icon">&#xe640;</i></a>
</script>

<script>
    // var webCode = "";

    var byCode = "";
    $(function () {
        byCode = getUrlVariable("byCode");
        loadData();
        loadRdData();
    })

    var dUrl = '../Basic/GetDataList?dataType=bypd&condition=' //数据接口
    /*
    *加载数据
    * */
    function loadData() {
        layui.use('table', function () {
            var table = layui.table;
            var cols = table.render({
                elem: '#list'
                , url: dUrl + byCode
                , skin: 'row' //表格风格
                , even: true
                , page: false
                , limits: [20, 30, 40]
                , limit: 20 //每页默认显示的数量
                , cols: [[
  
                      { field: 'proCode', align: 'center', title: '存货编码', width: 110 }
                    , { field: 'proName', align: 'center', title: '存货名称', width: 250 }
                    , { field: 'spec', align: 'center', title: '规格', width: 130 }
                    , { field: 'createtime', align: 'center', title: '创建时间', width: 170 }
                    , { field: 'right', title: '数据操作', toolbar: '#zyTools', width: 100 }

                ]], done: function (data) {

                }
            });


            //监听工具条
            table.on('tool(list)', function (obj) {
                var data = obj.data;
                if (obj.event == 'del') {
                    layer.confirm('确定要删除选中数据？', function (index) {

                        $.ajax({
                            url: "../Basic/DelBanYangPro",
                            data: { dataId: data.id,byCode: data.byBarCode},
                            dataType: "json",
                            type: "POST",
                            async: false,
                            success: function (rsl) {
                                if (rsl.result) {
                                    obj.del();
                                    layer.msg("删除成功");
                                } else {
                                    layer.msg(info.message);
                                }
                                layer.close(index);
                            }
                        });
                       
                    });
                }
            });


        });
    }


    /*
    *加载存货bom
    * */
    function loadRdData() {
        layui.use('table', function () {
            var table = layui.table;
            var cols = table.render({
                elem: '#rdlist'
                , url: '../Basic/GetDataList?dataType=byri&condition=' + byCode
                , skin: 'row' //表格风格
                , even: true
                , page: false
                , limits: [20, 30, 40]
                , limit: 20 //每页默认显示的数量
                , cols: [[

                    { field: 'happenDate', align: 'center', title: '发生日期', width: 110 }
                    , { field: 'inoutName', align: 'center', title: '出入库类型', width: 150 }
                    , { field: 'userName', align: 'center', title: '操作人员', width: 130 }
                    , { field: 'createtime', align: 'center', title: '创建时间', width: 170 }
               

                ]], done: function (data) {

                }
            });


   

        });
    }



</script>

